package com.glodon.paas.exception;

import java.util.ArrayList;
import java.util.List;

public class PaasServerException extends PaasRuntimeException {

	private static final long serialVersionUID = 6648241217946542011L;
	
	protected int errorCode;
	
	protected int httpStatus = 500;
	
	protected List<String> objs;

	public PaasServerException(int errorCode, String message,Throwable cause ) {
		super(message,cause);
		this.errorCode=errorCode;
	}
	
	public int getErrorCode() {
		return errorCode;
	}

	public PaasServerException setErrorCode(int errorCode) {
		this.errorCode = errorCode;
		return this;
	}

	public int getHttpStatus() {
		return httpStatus;
	}

	public PaasServerException setHttpStatus(int httpStatus) {
		this.httpStatus = httpStatus;
		return this;
	}

	public List<String> getObjs() {
		return objs;
	}

	public void setObjs(List<String> objs) {
		this.objs = objs;
	}
	
	public PaasServerException addString(String obj){
		if(objs==null){
			objs = new ArrayList<String>();
		}
		objs.add(obj);
		return this;
	}
	
	public PaasServerException addObj(Object obj){
		if(objs==null){
			objs = new ArrayList<String>();
		}
		objs.add(obj.toString());
		return this;
	}
}
